<?php
	include_once 'inc/tool.inc.php';
	$id = $_GET['id'];
	$msg = $_GET['msg'];

	if($msg == 'famousScenery' && isset($msg) && isset($id) && is_numeric($id)){
		$template['title']='风景名胜';
	}else if($msg == 'hotSpots' && isset($msg) && isset($id) && is_numeric($id)){
		$template['title']='热门景点';
	}else if($msg == 'tavern' && isset($msg) && isset($id) && is_numeric($id)){
		$template['title']='酒店宾馆';
	}else if($msg == 'scenery' && isset($msg) && isset($id) && is_numeric($id)){
		$template['title']='中国名胜';
	}else{
		skip('index.php','error','参数错误！');
	}
	include_once 'inc/header_inc.php';
	include_once 'inc/page.inc.php';
	
	if(isset($_GET['content'])){
		skip('comment.php', 'ok', '你真的要删除这条评论吗? <a href="Mymessage.php?confirm=1">确定</a> | <a href="Mymessage.php">取消<a>');

	}

	if($msg == 'famousScenery'){
		$query="select * from propage2 where id=".$id;
	}else if($msg == 'hotSpots'){
		$query="select * from propage where id=".$id;
	}else if($msg == 'tavern' || $msg == 'scenery'){
		$query="select * from leftInfo where id=".$id;
	}
	$result=execute($link,$query);
	$data=mysqli_fetch_assoc($result);
	if(!mysqli_num_rows($result)){
		skip('hotSpots.php','error','这条用户信息不存在！');
	}

?>

			<!-- 当前位置 -->
			<div class="loaction">
				<ol class="breadcrumb">
					<li><img src="img/location.gif" />当前位置:</li>
					<li><a href="index.php"> 首页 </a> >>  <a href="<?php echo $_SERVER['REQUEST_URI'] ?>" class="active"><?php echo $data['title'] ?></a> </li>
					<div class="search">
						<form action="" method="post">
							<input type="text" placeholder="请输入关键字查询" name="search" class="form-control" />
							<input type="submit" class="btn btn-primary" value="搜索" />
						</form>
					</div>
				</ol>
			</div>

			<div id="main">

				<div class="introduce">
					<div class="introduce_01">
						<div class="propic">
							<?php echo $data['propic'] ?>
						</div>
						<div class="content">
							<?php echo $data['note'] ?>
						</div>
						
					</div>
					<div class="deteiled">
						<div class="title">
							<ul>
								<li>旅游详细</li>
								<li class="active">累计评论
									<span>
										<?php
											$query="select content from comment";
											$result=execute($link,$query);
											$rows=mysqli_affected_rows($link);
											if($rows){
												echo $rows;
											}else{
												echo $rows;
											}
										?>
									</span>
								</li>
							</ul>
						</div>
						<div class="title2">景点详情</div>
						<?php echo $data['content'] ?>
					</div>

					<div class="comment">
						<div class="info">
							<form action='' method='post'>
								<?php
								echo "<div class='comment_info'><p>留下您精彩的评论!</p>
									<div class='massage'>
										<textarea rows='5' border='none' placeholder='有事没事说两句...' cols='5' name='comment' class='form-control text'></textarea> 
									</div>  <br /> 
									<a href='javascript:;' class='dis'>发表</a></div>";
								echo "<span class='message_ti'>精彩留言</span>";

								//查询是否有点评内容，如果没有就输入图标
								$query="select content from comment";
								$result=execute($link,$query);
								$data=mysqli_fetch_row($result);
					
								$query2="select userinfo.headImg,userinfo.username,comment.user,comment.content,comment.time from userinfo,comment where userinfo.username=comment.user";
								$result2=execute($link,$query2);
								$data2=mysqli_fetch_assoc($result2);

								if(!$data){
									echo "<div class='noContent'><img src='img/noContent.png' /><br />您的点评空空如也</div>";
								}else{

									//分页部分
									echo "<div class='pages'>";
										//调用分页函数
										$page=page($rows,5,5);

										$query="select * from comment {$page['limit']}";
										$result=execute($link,$query);
										while ($data=mysqli_fetch_assoc($result)){
											echo "<div class='content2'><div class='headImg'><img src={$data2['headImg']} /></div> <div class='name'><div class='username'>".$data['user']."</div> <div class='info2'>".$data['content']."</div></div> <div class='time'>".$data['time']."</div></div> ";
										}
										
										echo "<div class='page_btn'>";
											//出入按钮HTML部分
											echo $page['html'];
										echo "</div>";
									echo "</div>";
								}
							?>
							</form>
						</div>
					</div>
				</div>
				<?php
					include 'inc/sidebar_inc.php';
				?>
			</div>

			<!-- 友情链接 -->
			<div class="friendly">
				<div class="silde">友<br/>情<br/>链<br/>接</div>
				<ul>
					
				</ul>
			</div>
		</div>
		<?php
			include 'inc/footer_inc.php';
		?>

	<script src="js/script.js"></script>
	<script>
	window.onload=function(){

			//留言框特效
			comment();

			TabSrc('introduce_01','img/Scenery_7');

			TabSwitch();

			nav();

		}
	</script>
	<script src="js/bootstrap.min.js"></script>
	</body>
</html>
